﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WastedMechanics.CharState
{
    public class CharStatePick : CharStateSimpleAction
    {
        Described Target;        

        public CharStatePick(Character chr, Described target)
            : base(chr)
        {
            ActionTime = 0.5f;
            Target = target;
        }

        public override void Enter()
        {            
            Character.TurnTo(Target.Position);
            if (Character.Position.y - Target.Position.y < 0.5f * Character.Body.BoundingBox.HalfSize.y)
                AnimationName = "PickItemFront";
            else
                AnimationName = "PickItemDown";
            Character.CanTurn = false;

            base.Enter();
        }

        public override void ActionPerform()
        {
            Character.PickObject(Target);
        }

        public override CharState GetNextState()
        {
            return new CharStateIdleNothing(Character);
        }            
    }
}
